home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / textwndw.swg / 0008_Moving Text Images.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-08-27  |  1.4 KB  |  62 lines

  1. {
  2. SEAN PALMER
  3.  
  4. >I was looking threw a Turbo C++ manual and noted some
  5. >Procedures that deal With the Text screen, such as
  6. >Get/PutTextImage. I was wondering if anyone has created one
  7. >for Pascal to move/save Text images around the screen like
  8. >in C++.
  9.  
  10. Copies a rectangular section from one video buffer (any size) to another
  11. }
  12.  
  13. Procedure moveScr(Var srcBuf; srcX, srcY, width, height, srcBufW,
  14.                       srcBufH : Word; Var dstBuf; dstX, dstY, dstBufW,
  15.                       dstBufH : Word); Assembler;
  16. Asm
  17.   cld
  18.   push ds
  19.   lds  si, srcBuf    {calc src adr}
  20.   mov  ax, srcBufW
  21.   mul  srcY
  22.   add  ax, srcX
  23.   shl  ax, 1
  24.   add  si, ax
  25.   les  di, dstBuf    {calc dst adr}
  26.   mov  ax, dstBufW
  27.   mul  dstY
  28.   add  ax, dstX
  29.   shl  ax, 1
  30.   add  di, ax
  31.   mov  dx, height    {num lines}
  32.   mov  ax, SrcBufW   {calc ofs between src lines}
  33.   sub  ax, width
  34.   shl  ax, 1
  35.   mov  bx, dstBufW   {calc ofs between dst lines}
  36.   sub  bx, width
  37.   shl  bx, 1
  38.  @L:
  39.   mov  cx, width
  40.   rep  movsw
  41.   add  si, ax
  42.   add  di, bx
  43.   dec  dx
  44.   jnz  @L
  45.   pop  ds
  46. end;
  47.  
  48. Var
  49.   s : Array [0..24,0..79,0..1] of Char Absolute $B800 : 0;
  50.   d : Array [0..11,0..39,0..1] of Char;
  51.   i : Integer;
  52.  
  53. begin
  54.   For i := 1 to 25 * 10 do
  55.     Write('(--)(--)');
  56.   moveScr(s,0,0,40,12,80,25,d,0,0,40,12); {copy 40x12 block to buf}
  57.   readln;
  58.   moveScr(d,0,0,38,10,40,12,s,5,5,80,25); {copy part back to screen}
  59.   readln;
  60. end.
  61.  
  62.